<?php
/*
 * Created on 22.04.2008
 *
 * To change the template for this generated file go to
 * Window - Preferences - PHPeclipse - PHP - Code Templates
 */
 define ('MODEL_COLOR_ALL',			'SELECT `description` FROM `colors_dict`');
 define ('MODEL_COLOR_FIND',		'SELECT * FROM `colors_dict` WHERE `id` = ? ');
 define ('MODEL_COLOR_ADD',			'INSERT INTO `colors_dict` (`id` ,`picture` ,`description`) VALUES (NULL , "", ?)');
 define ('MODEL_COLOR_SAVE',		'UPDATE `colors_dict` SET `picture`=?, `description`=? WHERE `id`=? ');
 
 
 class Model_Color extends Model_Binarymask {
 	protected $MASK = array();
 	
 	
 	function getList() {
 		$sth = $this->dbh->prepare(MODEL_COLOR_ALL);
 		$sth->execute();
 		
 		$this->MASK = $sth->fetchAll();
 		return $this->MASK;
 	}
 	
 	function save($picture, $description,$id) {
 		return $this->execute(MODEL_COLOR_SAVE, array($picture, $description,$id));
 	}
 	
 	function add($description) {
 		return $this->insertRow(MODEL_COLOR_ADD,array($description));
 	}
 	
 	function find($args) {
 		return $this->getRow(MODEL_COLOR_FIND,array($args[id]));
 	}
 }
?>
